<!DOCTYPE HTML>
<!--
  Dopetrope 2.0 by HTML5 UP
  html5up.net | @n33co
  Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
  <head>
    <title>Event Flairs gadget</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,900,300italic" rel="stylesheet" />
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.dropotron.js"></script>
    <script src="js/config.js"></script>
    <script src="js/skel.min.js"></script>
    <script src="js/skel-panels.min.js"></script>
    <script src="js/ZeroClipboard.min.js"></script>
    <!-- mine -->
    <script src="js/sets.js"></script>
    <script src="js/utils.js"></script>
    <script src="/static/images/flairs/master.js"></script>
    <noscript>
      <link rel="stylesheet" href="css/skel-noscript.css" />
      <link rel="stylesheet" href="css/style.css" />
      <link rel="stylesheet" href="css/style-desktop.css" />
    </noscript>
      <link rel="stylesheet" href="css/choose.css" />
    <!--[if lte IE 8]><script src="js/html5shiv.js"></script><link rel="stylesheet" href="static/css/ie8.css" /><![endif]-->
  </head>
  <body class="homepage">
    <div id="cart">
      <h5 class="cart-title">Your Custom Flairs Sets</h5>
      <div style="text-align:center">
        <button id="flairs-button" data-clipboard-text="" class="">Copy flairs set !</button>
        <div id="flairs-button-next" style="display: none; text-align: center; background-color: rgb(0, 0, 139); color: white; font-size: 0.8em; background-position: initial initial; background-repeat: initial initial;">Go back to gadget, click "import" and paste</div>
      </div>
      <div id="custom-icons"></div>
    </div>
    <!-- Header Wrapper -->
      <div id="header-wrapper">
        <div class="container">
          <div class="row">
            <div class="12u">
            
              <!-- Header -->
                <section id="header">
                  
                  <!-- Logo -->
                    <h1><a href="/">Event Flairs</a></h1>
		    <h3 style="padding-bottom:15px">Build your own flairs set</h3>
                  
                  <!-- Nav -->
                    <nav id="nav">
                      <ul id="repos">
                      </ul>
                    </nav>

                </section>

            </div>
          </div>
        </div>
      </div>
    
    <!-- Main Wrapper -->
      <div id="choose-wrapper">
        <div class="container">
          <div class="row">
            <div class="12u">
              

                <section>
                  <div>
                    <div class="row">
                      <div class="12u">
                        <section class="box">
                          <header>
                            <h3 id="repo_name"></h3>
                          </header>
                          <p id="repo_icons">
                          Select an icon collection. Once loaded, just click on the icons you want, your custom flairs set will get filled. When ready, just click on the "Copy flairs set" button, and import <img src="/static/images/import.gif"> button on gadget's toobar.<br><br>
			  You can suggest a new icon collection and have it displayed here ! Just <a href="https://groups.google.com/forum/#!forum/event-flairs">join</a> the group and post your favorite icon collection. Remember, they must be free use (personal and commercial), should be available in PNG or GIF format, and sized as 16x16.
                          </p>
                        </section>
                      </div>
                    </div>
                  </div>
                </section>
              
            </div>
          </div>
        </div>
      </div>

    <!-- Footer Wrapper -->
      <div id="footer-wrapper">
        
        <!-- Footer -->
          <section id="footer" class="container">
            <div class="row">
              <div class="8u">

              </div>
              <div class="4u">
              
                <section>
                  <header>
                    <h2>About</h2>
                  </header>
                  <p>
                  Event Flairs gadget is a replacement of original Event Flairs lab for Google Calendar. Event Flairs are used
                  to add little icons to events. Original lab hasn't been working properly lately so this gadget is an alternative
                  solution.
                  </p>
                  <p>
                  Event Flairs gadget is an open source project, powered by enthousiastic people and volunteers. 
                  </p>
                </section>
              
              </div>
              <div class="4u">

                <section>
                  <header>
                    <h2>Disclaimer</h2>
                  </header>
                  <p>
                  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
                  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
                  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
                  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
                  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
                  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
                  OTHER DEALINGS IN THE SOFTWARE.
                  </p>
                </section>

              </div>
              <div class="4u">
              
                <section>
                  <header>
                    <h2>Be social</h2>
                  </header>
                  <ul class="social">
                    <li class="facebook"><a href="#" class="icon48 icon48-1">Facebook</a></li>
                    <li class="twitter"><a href="http://twitter.com/n33co" class="icon48 icon48-2">Twitter</a></li>
                    <li class="dribbble"><a href="http://dribbble.com/n33" class="icon48 icon48-3">Dribbble</a></li>
                    <li class="linkedin"><a href="#" class="icon48 icon48-4">LinkedIn</a></li>
                    <li class="googleplus"><a href="#" class="icon48 icon48-6">Google+</a></li>
                  </ul>
                  <ul class="contact">
                    <li>
                      <h3>Mail</h3>
                      <p><a href="#">eventflairs[at]gmail.com</a></p>
                    </li>
                  </ul>
                </section>
              
              </div>
            </div>
            <div class="row">
              <div class="12u">
              
                <!-- Copyright -->
                  <div id="copyright">
                    <ul class="links">
                      <li>&copy; Sebastien Lelong</li>
                      <li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
                    </ul>
                  </div>

              </div>
            </div>
          </section>
        
      </div>
  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  
    ga('create', 'UA-42714430-1', 'eventflairs.appspot.com');
    ga('send', 'pageview');
  </script>

  <script>

  var userFlairs = {};

  function initRepositories()
  {
    for(var idx in MASTER)
    {
      var repo = MASTER[idx];
      $("#repos").append("<li class='repo' onclick='loadRepository(" + idx + ")'><a>" + repo['name'] + "</a></li>");
    }
  }
  
  function removeIcon(elem)
  {
    var res = splitRootIcon(elem.src);
    if(res.root in userFlairs)
    {
      userFlairs[res.root].splice(userFlairs[res.root].indexOf(res.icon),1);
      // need to delete root ?
      if(!userFlairs[res.root].length)
        delete userFlairs[res.root];
      elem.remove();
      $("#flairs-button").attr("data-clipboard-text",JSON.stringify(userFlairs));
    }
  }

  function selectIcon(elem)
  {
    var url = elem.src;
    // -> extract roo url and check if it exists
    var res = splitRootIcon(url);
    var icon = res.icon;
    var root = res.root;
    if(root in userFlairs)
    {
      userFlairs[root].push(icon);
    }
    else
    {
      userFlairs[root] = [icon];
    }
    // update clipboard content
    $("#flairs-button").attr("data-clipboard-text",JSON.stringify(userFlairs));
     // add img element
    var img = $("<img src='" + url + "'>");
    $(img).attr("onclick","removeIcon(this)");
    $(img).addClass("custom-icon");
    $("#custom-icons").append(img);
  }

  function loadRepository(idx)
  {
    var repo = MASTER[idx];
    $("#repo_name").empty();
    $("#repo_icons").empty();
    $.getScript(repo['def'],function() {
      $("#repo_name").append(REPOSITORY['name']);
      var url = REPOSITORY['url'];
      $("#repo_icons").append("<div><a href='" + url + "'>" + url + "</a></div>");
      $("#repo_icons").append("<br>");
      for(var catk in REPOSITORY['categories'])
      {
        var dcat = REPOSITORY['categories'][catk];
        for(var catname in dcat)
        {
          var e = $("#repo_icons").append("<div>" + catname + "</div>");
          for(var url in dcat[catname])
          {
            e.append("<img class='icon' src='" + dcat[catname][url] + "' onclick='selectIcon(this)'>");
          }
        }
      }
    });
    var scr = $("<script></script");

  }

  $(document).ready(initRepositories);

  $().ready(function() {
    var $scrollingDiv = $("#cart");
 
    $(window).scroll(function(){      
      $scrollingDiv
        .stop()
        .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow" );      
    });
  });

  var clip = new ZeroClipboard( document.getElementById("flairs-button"), {
    moviePath: "/js/ZeroClipboard.swf"
  });
  clip.on( "complete", function(client, args) {
    document.getElementById(this.id + "-next").style.display = "block";
  });
  </script>

  </body>
</html>
